home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-03-17 | 4.0 KB | 122 lines | [TEXT/CWIE] |
- //
- // CQD3DPane.h
- //
- // class CQD3DPane
- // A Pane for rendering a QuickDraw 3D view.
- //
- // by James Jennings
- // Started November 21, 1995
- //
- // New Strategy, June 25, 1996
- // Rather than make this class abstract, make it always usable.
- // When the mModel (or whatever) isn't available,
- // display using some reasonable default.
- // We add the missing pieces with SetModel() (or whatever.)
- //
- // Internal objects will all be made on demand so they might be set first
- // without having to destroy the old version.
- //
- // Note: Since "Erase on Update" is on, you must call Draw(nil) rather than Refresh()
- // or else you'll get some nasty flickering.
- //
-
- #pragma once
-
- #include <LPane.h>
- #include <QD3DView.h>
- #include <QD3DShader.h>
-
- class CQD3DPane : public LPane {
- friend class StSubmittingSetter;
- public:
- enum { class_ID = 'Q3pn' };
- // This is an abstract class: we can't create it directly from a stream.
- static CQD3DPane* CreateFromStream(LStream *inStream);
- static void Register(void)
- { URegistrar::RegisterClass(CQD3DPane::class_ID,
- (ClassCreatorFunc) CQD3DPane::CreateFromStream); }
-
- CQD3DPane();
- CQD3DPane(const CQD3DPane &inOriginal);
- CQD3DPane(LStream *inStream);
-
- virtual ~CQD3DPane();
-
- virtual void RebuildView();
-
- virtual TQ3StyleObject GetInterpolation();
- virtual TQ3StyleObject GetBackFacing();
- virtual TQ3StyleObject GetFill();
-
- virtual TQ3DrawContextObject GetDrawContext(void);
- virtual void SetClearImageColor(const TQ3ColorARGB &inColor);
- virtual void GetClearImageColor(TQ3ColorARGB &outColor);
-
- virtual void SetRenderer(TQ3RendererObject inRenderer);
- virtual TQ3RendererObject GetRenderer(void);
- virtual void SetModel( TQ3GroupObject inGroup );
- virtual TQ3GroupObject GetModel(void);
- virtual void SetCamera( TQ3CameraObject inGroup );
- virtual TQ3CameraObject GetCamera(void);
- virtual void SetLights( TQ3GroupObject inGroup );
- virtual TQ3GroupObject GetLights(void);
- virtual void SetDefaultAttributes(TQ3AttributeSet inAttributes);
- virtual TQ3AttributeSet GetDefaultAttributes(void);
- virtual void SetViewHints(TQ3ViewHintsObject inHints);
- // virtual TQ3ViewHintsObject GetViewHints(void);
-
- virtual void CalcBoundingBox(TQ3BoundingBox &outBox,
- TQ3ComputeBounds inComputeBounds = kQ3ComputeBoundsApproximate);
- virtual void Write( TQ3FileObject inFile );
-
- static void FatalErrorSeen() { sSawFatalError = true; }
-
- protected:
- virtual TQ3ViewObject GetView();
-
- // Style accessors
- // Override to change these styles.
- virtual TQ3InterpolationStyle GetInterpolationStyle()
- { return kQ3InterpolationStyleNone; }
- virtual TQ3BackfacingStyle GetBackfacingStyle()
- { return kQ3BackfacingStyleBoth; }
- virtual TQ3FillStyle GetFillStyle()
- { return kQ3FillStyleFilled; }
-
- // Rendering
- virtual void DrawSelf();
- virtual void ResizeFrameBy(Int16 inWidthDelta, Int16 inHeightDelta,
- Boolean inRefresh);
- virtual void MoveBy(Int32 inHorizDelta, Int32 inVertDelta,
- Boolean inRefresh);
- protected:
- virtual TQ3Status SubmitScene();
-
- // adjust the camera to the frame size
- virtual void AdjustQ3ViewToFrame();
-
- protected:
- TQ3ViewObject mView ; // the view for the scene
- TQ3GroupObject mModel ; // object in the scene being modelled
- TQ3GroupObject mLights ;
- TQ3CameraObject mCamera ;
- TQ3DrawContextObject mDrawContext;
- TQ3RendererObject mRenderer;
- TQ3AttributeSet mDefaultAttributes;
- TQ3StyleObject mInterpolation ; // interpolation style used when rendering
- TQ3StyleObject mBackFacing ; // whether to draw shapes that face away from the camera
- TQ3StyleObject mFillStyle ; // whether drawn as solid filled object or decomposed to components
-
- static Boolean sSawFatalError; // Stop processing when there is a fatal error
- static Boolean sNowSubmitting; // Keep submitting loops from being reentrant.
- };
-
- class StSubmittingSetter {
- public:
- StSubmittingSetter()
- { Assert_( !CQD3DPane::sNowSubmitting ); CQD3DPane::sNowSubmitting = true; }
- ~StSubmittingSetter()
- { CQD3DPane::sNowSubmitting = false; }
- };
-
-